
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <title>cocoapods 组件化 私有仓库</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=2.0">
<link rel="stylesheet", href="/./css/style.css">
<link rel="shortcut icon", href="/./favicon.ico">
<link rel="apple-touch-icon", href="/./apple-touch-icon.png">

        
    
        <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
    
    <link rel='stylesheet' href="/./css/dracula.css">

    <meta name="generator" content="Hexo 4.2.0"></head>
    <body>
        <header class="al_header al_pos_fixed">
    <div class="al_header_container dis_flex_jcenter">
        <div class="al_header_container_left">
            <div class="al_header_site_title">
                <a href="/">Kevin' Blog</a>
            </div>
        </div>

        <div class="dis_flex_jcenter">
            <div class="al_header_setting">
                <svg class="al_header_icon">
                    <use xmlns="http://www.w3.org/2000/svg" xlink:href="/assets/svg_icons.svg#svg-menu"></use>
                </svg>
            </div>
        </div>
    </div>
</header>

        <div class="al_sidebar">

    <div class="al_sidebar_overlay al_full_cover"></div>

    <div class="al_pos_fixed al_sidebar_cnt">
        <div class="dis_flex_acenter al_sidebar_header">
            <h3>Kevin' Blog</h3>
            <div class="al_sidebar_close al_header_setting">
                <svg class="al_header_icon">
                    <use xmlns="http://www.w3.org/2000/svg" xlink:href="/assets/svg_icons.svg#svg-close"></use>
                </svg>
            </div>
        </div>

        <div class="al_sidebar_author_cnt">

            <div class="al_sidebar_author_info">
                <h4>Kevin</h4>
                <img class="al_sidebar_avatar" src="https://gitee.com/zcwtr/zcwtr/raw/master/image/avatar.jpeg">
                <p>極</p>
            </div>

            
        </div>
    </div>
</div>

        
    <div class="dis_flex_center al_lightbox_cnt al_full_cover">
        <img class="al_lightbox_img"/>
    </div>
    <div class="al_page_background dis_flex_center al_full_cover"></div>
    <div class="al_page_container">
        <div class="al_pos_ab al_fake_background"></div>
        <div class="al_main_container al_main_page_container">
            <article class="al_article">
                <header>
                    <h1 class="al_page_title">
                        cocoapods 组件化 私有仓库
                    </h1>
                    <div class="al_page_info dis_flex">
                        <div class="al_page_content_info">
                            June 19, 2021 08:06 AM
                        </div>

                        
                            <div class="al_page_content_info">
                                385 words
                            </div>
                        

                        
                            <div class="al_page_content_info">
                                1 minutes read
                            </div>
                        
                        <span class="tags"></span>
                    </div>
                </header>

                

                
                <section id="post-body">
                    <blockquote>
<p>随着项目功能的不断增加，越来越多的开发人员加入，业务主线也随之越来越多，造成耦合越来越严重，编译越来越慢，测试不独立等一系列问题。为了解决此类情况，我们可以考虑到使用组件化开发.</p>
</blockquote>
<ul>
<li>组件化就是将一个单一工程的项目, 分解成为各个独立的组件， 然后按照某种方式, 任意组织成一个拥有完整业务逻辑的工程。</li>
</ul>
<p>###步骤如下</p>
<ol>
<li><p>创建远程索引库和私有库</p>
</li>
<li><p>将远程索引库添加到本地 <code>pod repo add 索引库名称 索引库地址</code></p>
</li>
<li><p>在本地创建一个pod模板库 <code>pod lib create 组件名称</code><br>将框架的核心代码添加到Classes目录下<br>本地安装测试核心代码是否可用 <code>pod install</code><br>修改Spec描述文件<br>将修改好的模板库上传至远程私有库</p>
</li>
<li><p>上传代码和打标签</p>
<p><code>pod lib create 组件名</code></p>
<p><code>git init</code></p>
<p><code>git add .</code></p>
<p><code>git commit -m &quot;提交描述&quot;</code></p>
<p><code>git push origin master</code></p>
<p><code>git tag &#39;0.1.0&#39;</code></p>
<p><code>git push --tags</code></p>
</li>
<li><p>提交spec至私有索引库</p>
<p><code>pod repo</code>查看私有索引库</p>
<p><code>pod repo add 索引库的本地名称 索引库的远程git仓库地址</code>查看私有索引库</p>
<p><code>pod lib lint --private</code></p>
<p><code>pod spec lint --private</code></p>
<p><code>pod repo push 索引库的本地名称 xx.podspec</code></p>
</li>
<li><p>使用</p>
<p><code>source 官方索引库远程git地址</code></p>
<p><code>source 私有索引库远程git地址</code></p>
<p><code>pod &#39;组件名称&#39;</code></p>
<p><code>pod install</code></p>
</li>
</ol>

                </section>

                
                
    <div id="al_gitalk_cnt">
    <script src="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
    <script>
        var gitalk = new Gitalk({
            clientID: "b311dfc46e6eb58aa382",
            clientSecret: "386b7ecdfdbe4da2b35281a0d168fe13284572cb",
            repo: "comment",
            owner: "ZTKevin",
            admin: "ZTKevin",
            id: "cocoapods 组件化 私有仓库",
        });
        gitalk.render("al_gitalk_cnt")
    </script>
                


            
            <nav class="dis_flex post-nav">
                <span class="prev">
                    
                </span>
                <span class="next">
                    
                        <a href="/2021/01/04/Runtime/">
                            Older Posts
                            <span class="arrow"> → </span>
                        </a>
                    
                </span>
            </nav>
        </div>
    </div>


        <div class="al_index_footer dis_flex_center">
    <div class="al_index_footer_item al_index_footer_title">
        Kevin
    </div>

    
    

    <div class="al_index_footer_item al_index_footer_extra">
        Created By 
        <a href="https://github.com/iGuan7u/Acetolog" target="_blank" rel="noopener">AcetoLog</a>
         · Power By 
        <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo<a>
    </div>

    <div class="al_index_footer_item al_index_footer_extra_right">
        All Right Reserved
    </div>
</div>

        <script type="text/javascript" async="async" src="/javascripts/acelog.js"></script>
        
        
        
        
    </body>
</html>
        